<?php

 /**
 * checks mimetype to see if it's a JPEG file
 * @param string $file_type
 * @return bool
 */
  function is_jpeg($file_type)
  {
    if( $file_type == 'image/jpeg' or $file_type == 'image/pjpeg')
		{
			return true;
		}
		else
		{
		  return false;
		}
  }


 /**
 * make sure user uploads a file of a certain size.
 * @param string $file_path
 * @return bool
 */
  function is_valid_width_height($file_path)
   {
		 $width = 250;
		 $height = 250;

     list($img_width, $img_height) = getimagesize($file_path);
     
		 if($img_width >= $width and $img_height >= $height)
		 {
			 return true;
		 }
		 else
		 {
			 return false;
		 }
   }


	/**
	 * checks to see if file is greater than 1MB by default
	 * @param string $file_size
	 * @param int $max_size
	 * @return bool
	 */
	function is_valid_file_size($file_size, $max_size = 2097159)
	{
	  if($file_size > $max_size)
		{
		  return false;
		}
		else
		{
		  return true;
		}
	}



  /**
   * Returns True if all fields are filled out
   * @param array $params
   * @return bool
   */
  function is_fields_filled_out($params)
  {
    foreach($params as $key => $value)
		{
		  if( !isset($key) || 	($value == '') )
		  {
			  return false;
			}
		}
		return true;
  }










?>
